package com.member.server.domain.param;

import com.alibaba.fastjson.JSON;

/**
 * @author gaojx1993
 * @version 1.0
 * @description PagingQueryParam
 * @since 2023/7/12 13:42
 */
public class PagingQueryParam extends QueryParam {

    private Integer pageNum;

    private Integer pageSize;

    public Integer getPageNum() {
        return pageNum;
    }

    public int getOffset() {
        int pageNum = this.pageNum == null ? 1 : this.pageNum;
        int pageSize = this.pageSize == null ? 10 : this.pageSize;
        return (pageNum - 1) * pageSize;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}
